import time
from threading import Thread

class SubThread(Thread) :
    def run(self):
        for i in range(10) :
            time.sleep(1)
            msg = '线程name:%s 执行了 %d'%(self.name,i)
            print(msg)


if __name__ == '__main__' :
    print('---主线程开始-----')

    threads = [SubThread() for i in range(4) ]
    for thread in threads :
        thread.start()
    for thread in threads :
        thread.join()
    print('----主线程结束----')